pp108 : Retrieving Information about a Class

Retrieving Information about a Class

This topic describes the process of retrieving information about a class.


During a transaction, it may be necessary to get complete information about a class apart from the function that it performs. Every generated class in WS-AppServer, irrespective of whether it extends from StateBusObject or CustomBusObject , is associated with a class called ClassInfo . Applications can use this class internally for retrieving the details of a particular class, such as its attributes or relationships with other classes.

TheClassInfoobject holds the following information for a BusObject:

  • Details about the available attributes (AttributeInfo)
  • Details about the relations with other BusObjects (RelationInfo)

    For a pictorial representation of this class, refer to Structure of a BusObject.

Customizing ClassInfo

Although the ClassInfo is based on generated code in the base class, you can customize it, for example, to specify a custom DB Mapper. To customize the ClassInfo , define a method ( customizeClassInfo ) in the extension class with the following signature:

public static void customizeClassInfo(ClassInfo ci)
{
    // ...add your own code here...
}


Note: ci refers to the name of the ClassInfo.
When WS-AppServer calls the method _getClassInfo() , the customizeClassInfo method is generated in the Base class. TheClassInfoobject is created within the method. Later, when the method customizeClassInfo is called, the just created ClassInfo is accessed through the passed argumentci. If an exception occurs during the invocation of customizeClassInfo , aCustomizeClassInfoExceptionis thrown.

Related concepts

BusObjects

Related reference

Mapping of BusObjects in WS-AppServer
Structure of a BusObject
States of a BusObject
Passing the Parameters of BusObject Class
Returning the Objects of BusObject Class